<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
    /* 
      如果有多个元素都有3d效果，那么只需要给最外成的祖先元素添加perspective即可
      transform-origin
        x
          固定值 关键字 百分比
        y
          固定值 关键字 百分比
        z
          固定
     */
    ul {
      margin: 0;
      padding: 0;
      list-style: none;
    }
    body {
      transform-style: preserve-3d;
      perspective: 500px;

    }
    .box {
      position: relative;
      width: 200px;
      height: 200px;
      margin: 100px auto;
      transform-style: preserve-3d;      
      transition: all 5s;
      transform: rotateY(0deg) rotateX(0deg);
      transform-origin: right bottom -100px;
    }

    body:hover .box {
      transform: rotateY(360deg) rotateX(360deg);
    }

    .item {
      position: absolute;
      top: 0;
      left: 0;
      width: 200px;
      height: 200px;
      text-align: center;
      line-height: 200px;
      color: #fff;
      font-size: 72px;
      background: rgba(0,0,0, .6);
      box-sizing: border-box;
      border: 2px solid #eee;
    }
    
    .item:nth-child(1) {
      transform: rotateX(90deg) translateZ(100px);
    }
    
    .item:nth-child(2) {
      transform: rotateX(-90deg) translateZ(100px);
    }
    
    .item:nth-child(3) {
      transform: rotateY(-90deg) translateZ(100px);
    }

    .item:nth-child(4) {
      transform: rotateY(90deg) translateZ(100px);
    }

    .item:nth-child(5) {
      transform: translateZ(100px);
    }
    .item:nth-child(6) {
      transform: rotateY(180deg) translateZ(100px);
    }

   
  </style>
</head>
<body>
  <ul class="box">
    <li class="item">上</li>
    <li class="item">下</li>
    <li class="item">左</li>
    <li class="item">右</li>
    <li class="item">前</li>
    <li class="item">后</li>
  </ul>

</body>
</html>